const path = require('path');

module.exports = {
  publicPath: './',
  chainWebpack: (config) => {
    // 路径别名
    config.resolve.alias
      .set('@', resolve('src'))
      .set('@mixins', resolve('src/assets/less/mixins'))
      .set('@views', resolve('src/assets/less/views'));
  },
  devServer: {
    proxy: {
      '/v1': {
        target: 'http://xiaofang.wuyi.link',
        changeOrigin: true,
        pathRewrite: {
          '^/v1': '/v1',
        },
      },
    },
  },
};

function resolve(dir) {
  return path.join(__dirname, dir);
}
